mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 22:23:14 -04:00
Merge "asoc: send VAD enable or disable"
This commit is contained in:
commit
d12578a0ab
4 changed files with 204 additions and 136 deletions
|
|
@ -1091,17 +1091,6 @@ static int msm_dai_q6_auxpcm_prepare(struct snd_pcm_substream *substream,
|
|||
}
|
||||
|
||||
afe_open(aux_dai_data->rx_pid, &dai_data->port_config, dai_data->rate);
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/*
|
||||
* send island mode config
|
||||
* This should be the first configuration
|
||||
*/
|
||||
rc = afe_send_port_island_mode(aux_dai_data->tx_pid);
|
||||
if (rc)
|
||||
dev_err(dai->dev, "%s: afe send island mode failed %d\n",
|
||||
__func__, rc);
|
||||
}
|
||||
afe_open(aux_dai_data->tx_pid, &dai_data->port_config, dai_data->rate);
|
||||
goto exit;
|
||||
|
||||
|
|
@ -5029,18 +5018,6 @@ static int msm_dai_q6_mi2s_prepare(struct snd_pcm_substream *substream,
|
|||
dai->id, port_id, dai_data->channels, dai_data->rate);
|
||||
|
||||
if (!test_bit(STATUS_PORT_STARTED, dai_data->status_mask)) {
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/*
|
||||
* send island mode config.
|
||||
* This should be the first configuration
|
||||
*/
|
||||
rc = afe_send_port_island_mode(port_id);
|
||||
if (rc)
|
||||
dev_err(dai->dev, "%s: afe send island mode failed %d\n",
|
||||
__func__, rc);
|
||||
}
|
||||
|
||||
/* PORT START should be set if prepare called
|
||||
* in active state.
|
||||
*/
|
||||
|
|
@ -8296,17 +8273,6 @@ static int msm_dai_q6_tdm_prepare(struct snd_pcm_substream *substream,
|
|||
group_ref = &tdm_group_ref[group_idx];
|
||||
|
||||
if (!test_bit(STATUS_PORT_STARTED, dai_data->status_mask)) {
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/*
|
||||
* send island mode config.
|
||||
* This should be the first configuration
|
||||
*/
|
||||
rc = afe_send_port_island_mode(dai->id);
|
||||
if (rc)
|
||||
dev_err(dai->dev, "%s: afe send island mode failed %d\n",
|
||||
__func__, rc);
|
||||
}
|
||||
|
||||
if (msm_dai_q6_get_tdm_clk_ref(group_idx) == 0) {
|
||||
/* TX and RX share the same clk. So enable the clk
|
||||
|
|
@ -10573,17 +10539,6 @@ static int msm_dai_q6_cdc_dma_prepare(struct snd_pcm_substream *substream,
|
|||
int rc = 0;
|
||||
|
||||
if (!test_bit(STATUS_PORT_STARTED, dai_data->status_mask)) {
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/*
|
||||
* send island mode config.
|
||||
* This should be the first configuration
|
||||
*/
|
||||
rc = afe_send_port_island_mode(dai->id);
|
||||
if (rc)
|
||||
pr_err("%s: afe send island mode failed %d\n",
|
||||
__func__, rc);
|
||||
}
|
||||
if ((dai->id == AFE_PORT_ID_WSA_CODEC_DMA_TX_0) &&
|
||||
(dai_data->port_config.cdc_dma.data_format == 1))
|
||||
dai_data->port_config.cdc_dma.data_format =
|
||||
|
|
|
|||
139
asoc/qcs405.c
139
asoc/qcs405.c
|
|
@ -678,6 +678,60 @@ static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
|
|||
|
||||
static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
|
||||
|
||||
static int msm_island_vad_get_portid_from_beid(int32_t be_id, int *port_id)
|
||||
{
|
||||
*port_id = 0xFFFF;
|
||||
|
||||
switch (be_id) {
|
||||
case MSM_BACKEND_DAI_VA_CDC_DMA_TX_0:
|
||||
*port_id = AFE_PORT_ID_VA_CODEC_DMA_TX_0;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUINARY_MI2S_TX:
|
||||
*port_id = AFE_PORT_ID_QUINARY_MI2S_TX;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUIN_TDM_TX_0:
|
||||
*port_id = AFE_PORT_ID_QUINARY_TDM_TX;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUIN_AUXPCM_TX:
|
||||
*port_id = AFE_PORT_ID_QUINARY_PCM_TX;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qcs405_send_island_vad_config(int32_t be_id)
|
||||
{
|
||||
int rc = 0;
|
||||
int port_id = 0xFFFF;
|
||||
|
||||
rc = msm_island_vad_get_portid_from_beid(be_id, &port_id);
|
||||
if (rc) {
|
||||
pr_debug("%s: Invalid island interface\n", __func__);
|
||||
} else {
|
||||
/*
|
||||
* send island mode config
|
||||
* This should be the first configuration
|
||||
*/
|
||||
rc = afe_send_port_island_mode(port_id);
|
||||
if (rc) {
|
||||
pr_err("%s: afe send island mode failed %d\n",
|
||||
__func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = afe_send_port_vad_cfg_params(port_id);
|
||||
if (rc) {
|
||||
pr_err("%s: afe send vad config failed %d\n",
|
||||
__func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int slim_get_sample_rate_val(int sample_rate)
|
||||
{
|
||||
int sample_rate_val = 0;
|
||||
|
|
@ -4048,29 +4102,6 @@ static int msm_slim_get_ch_from_beid(int32_t be_id)
|
|||
return ch_id;
|
||||
}
|
||||
|
||||
static int msm_vad_get_portid_from_beid(int32_t be_id, int *port_id)
|
||||
{
|
||||
*port_id = 0xFFFF;
|
||||
|
||||
switch (be_id) {
|
||||
case MSM_BACKEND_DAI_VA_CDC_DMA_TX_0:
|
||||
*port_id = AFE_PORT_ID_VA_CODEC_DMA_TX_0;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUINARY_MI2S_TX:
|
||||
*port_id = AFE_PORT_ID_QUINARY_MI2S_TX;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUIN_TDM_TX_0:
|
||||
*port_id = AFE_PORT_ID_QUINARY_TDM_TX;
|
||||
break;
|
||||
case MSM_BACKEND_DAI_QUIN_AUXPCM_TX:
|
||||
*port_id = AFE_PORT_ID_QUINARY_PCM_TX;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_cdc_dma_get_idx_from_beid(int32_t be_id)
|
||||
{
|
||||
int idx = 0;
|
||||
|
|
@ -5073,6 +5104,34 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int msm_snd_auxpcm_startup(struct snd_pcm_substream *substream)
|
||||
{
|
||||
int ret = 0;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
|
||||
ret = qcs405_send_island_vad_config(dai_link->id);
|
||||
if (ret) {
|
||||
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_snd_cdc_dma_startup(struct snd_pcm_substream *substream)
|
||||
{
|
||||
int ret = 0;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
|
||||
ret = qcs405_send_island_vad_config(dai_link->id);
|
||||
if (ret) {
|
||||
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_snd_cdc_dma_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
|
|
@ -5499,6 +5558,7 @@ static int qcs405_tdm_snd_startup(struct snd_pcm_substream *substream)
|
|||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
u32 tdm_mode = msm_get_tdm_mode(cpu_dai->id);
|
||||
|
||||
if (tdm_mode >= TDM_INTERFACE_MAX) {
|
||||
|
|
@ -5543,6 +5603,13 @@ static int qcs405_tdm_snd_startup(struct snd_pcm_substream *substream)
|
|||
}
|
||||
}
|
||||
|
||||
ret = qcs405_send_island_vad_config(dai_link->id);
|
||||
if (ret) {
|
||||
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -5612,7 +5679,7 @@ 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;
|
||||
|
||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||
int index = cpu_dai->id;
|
||||
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
|
|
@ -5660,6 +5727,14 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||
msm_cdc_pinctrl_select_active_state(
|
||||
pdata->mi2s_gpio_p[index]);
|
||||
}
|
||||
|
||||
ret = qcs405_send_island_vad_config(dai_link->id);
|
||||
if (ret) {
|
||||
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
clk_off:
|
||||
if (ret < 0)
|
||||
msm_mi2s_set_sclk(substream, false);
|
||||
|
|
@ -5835,7 +5910,11 @@ static struct snd_soc_ops msm_mi2s_be_ops = {
|
|||
.shutdown = msm_mi2s_snd_shutdown,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops msm_auxpcm_be_ops = {
|
||||
.startup = msm_snd_auxpcm_startup,
|
||||
};
|
||||
static struct snd_soc_ops msm_cdc_dma_be_ops = {
|
||||
.startup = msm_snd_cdc_dma_startup,
|
||||
.hw_params = msm_snd_cdc_dma_hw_params,
|
||||
};
|
||||
|
||||
|
|
@ -7259,6 +7338,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_AUXPCM_RX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
|
|
@ -7273,6 +7353,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_capture = 1,
|
||||
.id = MSM_BACKEND_DAI_AUXPCM_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
/* Secondary AUX PCM Backend DAI Links */
|
||||
|
|
@ -7287,6 +7368,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_SEC_AUXPCM_RX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
|
|
@ -7301,6 +7383,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_capture = 1,
|
||||
.id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
/* Tertiary AUX PCM Backend DAI Links */
|
||||
|
|
@ -7315,6 +7398,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_TERT_AUXPCM_RX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
{
|
||||
|
|
@ -7328,6 +7412,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_capture = 1,
|
||||
.id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
/* Quaternary AUX PCM Backend DAI Links */
|
||||
|
|
@ -7342,6 +7427,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
|
|
@ -7356,6 +7442,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_capture = 1,
|
||||
.id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
/* Quinary AUX PCM Backend DAI Links */
|
||||
|
|
@ -7370,6 +7457,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_QUIN_AUXPCM_RX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
|
|
@ -7384,6 +7472,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = {
|
|||
.dpcm_capture = 1,
|
||||
.id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
.ops = &msm_auxpcm_be_ops,
|
||||
.ignore_suspend = 1,
|
||||
},
|
||||
};
|
||||
|
|
@ -7594,7 +7683,7 @@ static int msm_snd_vad_cfg_put(struct snd_kcontrol *kcontrol,
|
|||
pr_debug("%s: vad_enable=%d preroll_config=%d vad_intf=%d\n", __func__,
|
||||
vad_enable, preroll_config, vad_intf);
|
||||
|
||||
ret = msm_vad_get_portid_from_beid(vad_intf, &port_id);
|
||||
ret = msm_island_vad_get_portid_from_beid(vad_intf, &port_id);
|
||||
if (ret) {
|
||||
pr_err("%s: Invalid vad interface\n", __func__);
|
||||
goto done;
|
||||
|
|
|
|||
156
dsp/q6afe.c
156
dsp/q6afe.c
|
|
@ -2258,6 +2258,13 @@ int afe_send_port_island_mode(u16 port_id)
|
|||
u32 island_mode = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!(q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4)) {
|
||||
pr_debug("%s: AFE port[%d] API version is invalid!\n",
|
||||
__func__, port_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&island_cfg, 0, sizeof(island_cfg));
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
|
||||
|
|
@ -2306,66 +2313,105 @@ static int afe_get_vad_preroll_cfg(u16 port_id, u32 *preroll_cfg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int afe_send_port_vad_cfg_params(u16 port_id)
|
||||
int afe_send_port_vad_cfg_params(u16 port_id)
|
||||
{
|
||||
struct afe_param_id_vad_cfg_t vad_cfg;
|
||||
struct afe_mod_enable_param vad_enable;
|
||||
struct param_hdr_v3 param_info;
|
||||
u32 pre_roll_cfg = 0;
|
||||
struct firmware_cal *hwdep_cal = NULL;
|
||||
int ret = 0;
|
||||
uint16_t port_index = 0;
|
||||
|
||||
memset(&vad_cfg, 0, sizeof(vad_cfg));
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
|
||||
ret = afe_get_vad_preroll_cfg(port_id, &pre_roll_cfg);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE port[%d] get preroll cfg is invalid!\n",
|
||||
__func__, port_id);
|
||||
return ret;
|
||||
}
|
||||
param_info.module_id = AFE_MODULE_VAD;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = AFE_PARAM_ID_VAD_CFG;
|
||||
param_info.param_size = sizeof(vad_cfg);
|
||||
|
||||
vad_cfg.vad_cfg_minor_version = AFE_API_VERSION_VAD_CFG;
|
||||
vad_cfg.pre_roll_in_ms = pre_roll_cfg;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_info, (u8 *) &vad_cfg);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE set vad cfg for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
return ret;
|
||||
if (!(q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4)) {
|
||||
pr_err("%s: AFE port[%d]: AFE API version doesn't support VAD config\n",
|
||||
__func__, port_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
port_index = afe_get_port_index(port_id);
|
||||
|
||||
hwdep_cal = q6afecal_get_fw_cal(this_afe.fw_data, Q6AFE_VAD_CORE_CAL);
|
||||
if (!hwdep_cal) {
|
||||
pr_err("%s: error in retrieving vad core calibration",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
if (this_afe.vad_cfg[port_index].is_enable) {
|
||||
memset(&vad_cfg, 0, sizeof(vad_cfg));
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
|
||||
ret = afe_get_vad_preroll_cfg(port_id, &pre_roll_cfg);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE port[%d] get preroll cfg is invalid!\n",
|
||||
__func__, port_id);
|
||||
return ret;
|
||||
}
|
||||
param_info.module_id = AFE_MODULE_VAD;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = AFE_PARAM_ID_VAD_CFG;
|
||||
param_info.param_size = sizeof(vad_cfg);
|
||||
|
||||
vad_cfg.vad_cfg_minor_version = AFE_API_VERSION_VAD_CFG;
|
||||
vad_cfg.pre_roll_in_ms = pre_roll_cfg;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_info, (u8 *) &vad_cfg);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE set vad cfg for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
|
||||
hwdep_cal = q6afecal_get_fw_cal(this_afe.fw_data,
|
||||
Q6AFE_VAD_CORE_CAL);
|
||||
if (!hwdep_cal) {
|
||||
pr_err("%s: error in retrieving vad core calibration",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
param_info.module_id = AFE_MODULE_VAD;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = AFE_PARAM_ID_VAD_CORE_CFG;
|
||||
param_info.param_size = hwdep_cal->size;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_info,
|
||||
(u8 *) hwdep_cal->data);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE set vad cfg for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
param_info.module_id = AFE_MODULE_VAD;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = AFE_PARAM_ID_VAD_CORE_CFG;
|
||||
param_info.param_size = hwdep_cal->size;
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V6) {
|
||||
memset(&vad_enable, 0, sizeof(vad_enable));
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
param_info.module_id = AFE_MODULE_VAD;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = AFE_PARAM_ID_ENABLE;
|
||||
param_info.param_size = sizeof(vad_enable);
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_info, (u8 *) hwdep_cal->data);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE set vad cfg for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
return ret;
|
||||
port_index = afe_get_port_index(port_id);
|
||||
vad_enable.enable = this_afe.vad_cfg[port_index].is_enable;
|
||||
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_info, (u8 *) &vad_enable);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE set vad enable for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
pr_debug("%s: AFE set preroll cfg %d vad core cfg port 0x%x ret %d\n",
|
||||
__func__, pre_roll_cfg, port_id, ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(afe_send_port_vad_cfg_params);
|
||||
|
||||
static int remap_cal_data(struct cal_block_data *cal_block, int cal_index)
|
||||
{
|
||||
|
|
@ -3402,19 +3448,6 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
|
|||
|
||||
port_index = afe_get_port_index(port_id);
|
||||
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/* send VAD configuration if enabled */
|
||||
if (this_afe.vad_cfg[port_index].is_enable) {
|
||||
ret = afe_send_port_vad_cfg_params(port_id);
|
||||
if (ret) {
|
||||
pr_err("%s: afe send VAD config failed %d\n",
|
||||
__func__, ret);
|
||||
goto fail_cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Also send the topology id here: */
|
||||
if (!(this_afe.afe_cal_mode[port_index] == AFE_CAL_MODE_NONE)) {
|
||||
/* One time call: only for first time */
|
||||
|
|
@ -4365,19 +4398,6 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
|||
mutex_lock(&this_afe.afe_cmd_lock);
|
||||
port_index = afe_get_port_index(port_id);
|
||||
|
||||
if (q6core_get_avcs_api_version_per_service(
|
||||
APRV2_IDS_SERVICE_ID_ADSP_AFE_V) >= AFE_API_VERSION_V4) {
|
||||
/* send VAD configuration if is enabled */
|
||||
if (this_afe.vad_cfg[port_index].is_enable) {
|
||||
ret = afe_send_port_vad_cfg_params(port_id);
|
||||
if (ret) {
|
||||
pr_err("%s: afe send VAD config failed %d\n",
|
||||
__func__, ret);
|
||||
goto fail_cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Also send the topology id here: */
|
||||
if (!(this_afe.afe_cal_mode[port_index] == AFE_CAL_MODE_NONE)) {
|
||||
/* One time call: only for first time */
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
#define AFE_API_VERSION_V3 3
|
||||
/* for VAD and Island mode */
|
||||
#define AFE_API_VERSION_V4 4
|
||||
/* for VAD enable */
|
||||
#define AFE_API_VERSION_V6 6
|
||||
|
||||
|
||||
typedef int (*routing_cb)(int port);
|
||||
|
||||
|
|
@ -452,6 +455,7 @@ int afe_get_sp_rx_tmax_xmax_logging_data(
|
|||
u16 port_id);
|
||||
int afe_cal_init_hwdep(void *card);
|
||||
int afe_send_port_island_mode(u16 port_id);
|
||||
int afe_send_port_vad_cfg_params(u16 port_id);
|
||||
int afe_send_cmd_wakeup_register(void *handle, bool enable);
|
||||
void afe_register_wakeup_irq_callback(
|
||||
void (*afe_cb_wakeup_irq)(void *handle));
|
||||
|
|
|
|||
Loading…
Reference in a new issue