Merge "asoc: lahaina: add proxy ports for call screening in machine driver"

This commit is contained in:
qctecmdr
2020-05-10 05:35:13 -07:00
committed by Gerrit - the friendly Code Review server
9 changed files with 154 additions and 6 deletions

View File

@@ -5976,6 +5976,27 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = {
.ignore_pmdown_time = 1,
SND_SOC_DAILINK_REG(voice2_playback_tx),
},
/* Proxy Tx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_TX,
.stream_name = "Proxy Capture",
.no_pcm = 1,
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_PROXY_TX,
.ignore_suspend = 1,
SND_SOC_DAILINK_REG(proxy_tx),
},
/* Proxy Rx BACK END DAI Link */
{
.name = LPASS_BE_PROXY_RX,
.stream_name = "Proxy Playback",
.no_pcm = 1,
.dpcm_playback = 1,
.id = MSM_BACKEND_DAI_PROXY_RX,
.ignore_pmdown_time = 1,
.ignore_suspend = 1,
SND_SOC_DAILINK_REG(proxy_rx),
},
{
.name = LPASS_BE_USB_AUDIO_RX,
.stream_name = "USB Audio Playback",

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -2621,6 +2621,8 @@ static int msm_dai_q6_hw_params(struct snd_pcm_substream *substream,
case RT_PROXY_DAI_001_RX:
case RT_PROXY_DAI_002_TX:
case RT_PROXY_DAI_002_RX:
case RT_PROXY_PORT_002_TX:
case RT_PROXY_PORT_002_RX:
rc = msm_dai_q6_afe_rtproxy_hw_params(params, dai);
break;
case VOICE_PLAYBACK_TX:
@@ -4247,6 +4249,42 @@ static struct snd_soc_dai_driver msm_dai_q6_incall_record_dai[] = {
},
};
static struct snd_soc_dai_driver msm_dai_q6_proxy_tx_dai = {
.capture = {
.stream_name = "Proxy Capture",
.aif_name = "PROXY_TX",
.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
SNDRV_PCM_RATE_16000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.channels_min = 1,
.channels_max = 2,
.rate_min = 8000,
.rate_max = 48000,
},
.ops = &msm_dai_q6_ops,
.id = RT_PROXY_PORT_002_TX,
.probe = msm_dai_q6_dai_probe,
.remove = msm_dai_q6_dai_remove,
};
static struct snd_soc_dai_driver msm_dai_q6_proxy_rx_dai = {
.playback = {
.stream_name = "Proxy Playback",
.aif_name = "PROXY_RX",
.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
SNDRV_PCM_RATE_16000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.channels_min = 1,
.channels_max = 2,
.rate_min = 8000,
.rate_max = 48000,
},
.ops = &msm_dai_q6_ops,
.id = RT_PROXY_PORT_002_RX,
.probe = msm_dai_q6_dai_probe,
.remove = msm_dai_q6_dai_remove,
};
static struct snd_soc_dai_driver msm_dai_q6_usb_rx_dai = {
.playback = {
.stream_name = "USB Audio Playback",
@@ -7287,7 +7325,14 @@ register_uplink_capture:
pr_err("%s: Device not found stream name %s\n",
__func__, stream_name);
break;
case RT_PROXY_PORT_002_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_q6_component, &msm_dai_q6_proxy_rx_dai, 1);
break;
case RT_PROXY_PORT_002_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_q6_component, &msm_dai_q6_proxy_tx_dai, 1);
break;
default:
rc = -ENODEV;
break;

View File

@@ -697,6 +697,8 @@ struct msm_pcm_routing_bdai_data msm_bedais[MSM_BACKEND_DAI_MAX] = {
LPASS_BE_PRI_META_MI2S_RX},
{ AFE_PORT_ID_SECONDARY_META_MI2S_RX, 0, {0}, {0}, 0, 0, 0, 0,
LPASS_BE_SEC_META_MI2S_RX},
{ RT_PROXY_PORT_002_RX, 0, {0}, {0}, 0, 0, 0, 0, LPASS_BE_PROXY_RX},
{ RT_PROXY_PORT_002_TX, 0, {0}, {0}, 0, 0, 0, 0, LPASS_BE_PROXY_TX},
};
/* Track ASM playback & capture sessions of DAI
@@ -3532,7 +3534,7 @@ static const char *const be_name[] = {
"RX_CDC_DMA_RX_6", "RX_CDC_DMA_RX_7",
"PRI_SPDIF_TX", "SEC_SPDIF_RX", "SEC_SPDIF_TX",
"SLIM_9_RX", "SLIM_9_TX", "AFE_LOOPBACK_TX", "PRI_META_MI2S_RX",
"SEC_META_MI2S_RX"
"SEC_META_MI2S_RX", "PROXY_RX", "PROXY_TX"
};
static SOC_ENUM_SINGLE_DECL(mm1_channel_mux,
@@ -17201,6 +17203,17 @@ static const struct snd_kcontrol_new slimbus_3_rx_mixer_controls[] = {
msm_routing_put_voice_mixer),
};
static const struct snd_kcontrol_new proxy_rx_voice_mixer_controls[] = {
SOC_DOUBLE_EXT("VoiceMMode1", SND_SOC_NOPM,
MSM_BACKEND_DAI_PROXY_RX,
MSM_FRONTEND_DAI_VOICEMMODE1, 1, 0, msm_routing_get_voice_mixer,
msm_routing_put_voice_mixer),
SOC_DOUBLE_EXT("VoiceMMode2", SND_SOC_NOPM,
MSM_BACKEND_DAI_PROXY_RX,
MSM_FRONTEND_DAI_VOICEMMODE2, 1, 0, msm_routing_get_voice_mixer,
msm_routing_put_voice_mixer),
};
static const struct snd_kcontrol_new tx_voicemmode1_mixer_controls[] = {
SOC_DOUBLE_EXT("PRI_TX_MMode1", SND_SOC_NOPM,
MSM_BACKEND_DAI_PRI_I2S_TX,
@@ -17298,6 +17311,9 @@ static const struct snd_kcontrol_new tx_voicemmode1_mixer_controls[] = {
SOC_DOUBLE_EXT("PRI_TDM_TX_3_MMode1", SND_SOC_NOPM,
MSM_BACKEND_DAI_PRI_TDM_TX_3, MSM_FRONTEND_DAI_VOICEMMODE1,
1, 0, msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
SOC_DOUBLE_EXT("PROXY_TX_MMode1", SND_SOC_NOPM,
MSM_BACKEND_DAI_PROXY_TX, MSM_FRONTEND_DAI_VOICEMMODE1,
1, 0, msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
};
static const struct snd_kcontrol_new tx_voicemmode2_mixer_controls[] = {
@@ -17393,6 +17409,9 @@ static const struct snd_kcontrol_new tx_voicemmode2_mixer_controls[] = {
SOC_DOUBLE_EXT("PRI_TDM_TX_3_MMode2", SND_SOC_NOPM,
MSM_BACKEND_DAI_PRI_TDM_TX_3, MSM_FRONTEND_DAI_VOICEMMODE2,
1, 0, msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
SOC_DOUBLE_EXT("PROXY_TX_MMode2", SND_SOC_NOPM,
MSM_BACKEND_DAI_PROXY_TX, MSM_FRONTEND_DAI_VOICEMMODE2,
1, 0, msm_routing_get_voice_mixer, msm_routing_put_voice_mixer),
};
static const struct snd_kcontrol_new tx_voip_mixer_controls[] = {
@@ -24584,6 +24603,8 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
SND_SOC_DAPM_AIF_IN("SLIMBUS_9_TX", "Slimbus9 Capture", 0, 0, 0, 0),
SND_SOC_DAPM_AIF_OUT("USB_AUDIO_RX", "USB Audio Playback", 0, 0, 0, 0),
SND_SOC_DAPM_AIF_IN("USB_AUDIO_TX", "USB Audio Capture", 0, 0, 0, 0),
SND_SOC_DAPM_AIF_OUT("PROXY_RX", "Proxy Playback", 0, 0, 0, 0),
SND_SOC_DAPM_AIF_IN("PROXY_TX", "Proxy Capture", 0, 0, 0, 0),
/* Switch Definitions */
SND_SOC_DAPM_SWITCH("SLIMBUS_DL_HL", SND_SOC_NOPM, 0, 0,
@@ -25017,6 +25038,10 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
SND_SOC_NOPM, 0, 0,
wsa_cdc_dma_rx_0_voice_mixer_controls,
ARRAY_SIZE(wsa_cdc_dma_rx_0_voice_mixer_controls)),
SND_SOC_DAPM_MIXER("PROXY_RX_Voice Mixer",
SND_SOC_NOPM, 0, 0,
proxy_rx_voice_mixer_controls,
ARRAY_SIZE(proxy_rx_voice_mixer_controls)),
SND_SOC_DAPM_MIXER("RX_CDC_DMA_RX_0_Voice Mixer",
SND_SOC_NOPM, 0, 0,
rx_cdc_dma_rx_0_voice_mixer_controls,
@@ -27977,6 +28002,12 @@ static const struct snd_soc_dapm_route intercon[] = {
{"WSA_CDC_DMA_RX_0_Voice Mixer", "VoiceMMode2", "VOICEMMODE2_DL"},
{"WSA_CDC_DMA_RX_0", NULL, "WSA_CDC_DMA_RX_0_Voice Mixer"},
{"PROXY_RX_Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL"},
{"PROXY_RX", NULL, "PROXY_RX_Voice Mixer"},
{"PROXY_RX_Voice Mixer", "VoiceMMode2", "VOICEMMODE2_DL"},
{"PROXY_RX", NULL, "PROXY_RX_Voice Mixer"},
{"RX_CDC_DMA_RX_0_Voice Mixer", "Voip", "VOIP_DL"},
{"RX_CDC_DMA_RX_0_Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL"},
{"RX_CDC_DMA_RX_0_Voice Mixer", "VoiceMMode2", "VOICEMMODE2_DL"},
@@ -28145,6 +28176,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"VoiceMMode1_Tx Mixer", "QUAT_MI2S_TX_MMode1", "QUAT_MI2S_TX"},
{"VoiceMMode1_Tx Mixer", "QUIN_MI2S_TX_MMode1", "QUIN_MI2S_TX"},
{"VoiceMMode1_Tx Mixer", "PRI_TDM_TX_3_MMode1", "PRI_TDM_TX_3"},
{"VoiceMMode1_Tx Mixer", "PROXY_TX_MMode1", "PROXY_TX"},
{"VOICEMMODE1_UL", NULL, "VoiceMMode1_Tx Mixer"},
{"VoiceMMode2_Tx Mixer", "PRI_TX_MMode2", "PRI_I2S_TX"},
@@ -28174,6 +28206,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"VoiceMMode2_Tx Mixer", "QUAT_MI2S_TX_MMode2", "QUAT_MI2S_TX"},
{"VoiceMMode2_Tx Mixer", "QUIN_MI2S_TX_MMode2", "QUIN_MI2S_TX"},
{"VoiceMMode2_Tx Mixer", "PRI_TDM_TX_3_MMode2", "PRI_TDM_TX_3"},
{"VoiceMMode2_Tx Mixer", "PROXY_TX_MMode2", "PROXY_TX"},
{"VOICEMMODE2_UL", NULL, "VoiceMMode2_Tx Mixer"},
{"Voip_Tx Mixer", "PRI_TX_Voip", "PRI_I2S_TX"},
@@ -29479,6 +29512,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"BE_OUT", NULL, "RX_CDC_DMA_RX_5"},
{"BE_OUT", NULL, "RX_CDC_DMA_RX_6"},
{"BE_OUT", NULL, "RX_CDC_DMA_RX_7"},
{"BE_OUT", NULL, "PROXY_RX"},
{"PRI_I2S_TX", NULL, "BE_IN"},
{"MI2S_TX", NULL, "BE_IN"},
@@ -29575,6 +29609,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"TX_CDC_DMA_TX_5", NULL, "BE_IN"},
{"PRI_SPDIF_TX", NULL, "BE_IN"},
{"SEC_SPDIF_TX", NULL, "BE_IN"},
{"PROXY_TX", NULL, "BE_IN"},
};
static int msm_pcm_routing_hw_params(struct snd_pcm_substream *substream,

View File

@@ -42,6 +42,8 @@
#define LPASS_BE_VOICE2_PLAYBACK_TX "VOICE2_PLAYBACK_TX"
#define LPASS_BE_INCALL_RECORD_RX "INCALL_RECORD_RX"
#define LPASS_BE_INCALL_RECORD_TX "INCALL_RECORD_TX"
#define LPASS_BE_PROXY_RX "PROXY_RX"
#define LPASS_BE_PROXY_TX "PROXY_TX"
#define LPASS_BE_SEC_I2S_RX "SECONDARY_I2S_RX"
#define LPASS_BE_PRI_SPDIF_RX "PRI_SPDIF_RX"
#define LPASS_BE_PRI_SPDIF_TX "PRI_SPDIF_TX"
@@ -504,6 +506,8 @@ enum {
MSM_BACKEND_DAI_AFE_LOOPBACK_TX,
MSM_BACKEND_DAI_PRI_META_MI2S_RX,
MSM_BACKEND_DAI_SEC_META_MI2S_RX,
MSM_BACKEND_DAI_PROXY_RX,
MSM_BACKEND_DAI_PROXY_TX,
MSM_BACKEND_DAI_MAX,
};

View File

@@ -548,3 +548,13 @@ SND_SOC_DAILINK_DEFS(afe_loopback_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-dev.24577")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(proxy_tx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-dev.8195")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
SND_SOC_DAILINK_DEFS(proxy_rx,
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-dev.8194")),
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

View File

@@ -988,6 +988,8 @@ int afe_sizeof_cfg_cmd(u16 port_id)
break;
case RT_PROXY_PORT_001_RX:
case RT_PROXY_PORT_001_TX:
case RT_PROXY_PORT_002_RX:
case RT_PROXY_PORT_002_TX:
ret_size = SIZEOF_CFG_CMD(afe_param_id_rt_proxy_port_cfg);
break;
case AFE_PORT_ID_USB_RX:
@@ -4780,6 +4782,8 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
break;
case RT_PROXY_PORT_001_RX:
case RT_PROXY_PORT_001_TX:
case RT_PROXY_PORT_002_RX:
case RT_PROXY_PORT_002_TX:
cfg_type = AFE_PARAM_ID_RT_PROXY_CONFIG;
break;
case INT_BT_SCO_RX:
@@ -5327,6 +5331,10 @@ int afe_get_port_index(u16 port_id)
return IDX_AFE_PORT_ID_RX_CODEC_DMA_RX_7;
case AFE_LOOPBACK_TX:
return IDX_AFE_LOOPBACK_TX;
case RT_PROXY_PORT_002_RX:
return IDX_RT_PROXY_PORT_002_RX;
case RT_PROXY_PORT_002_TX:
return IDX_RT_PROXY_PORT_002_TX;
default:
pr_err("%s: port 0x%x\n", __func__, port_id);
return -EINVAL;
@@ -7524,6 +7532,8 @@ int afe_validate_port(u16 port_id)
case AFE_PORT_ID_TX_CODEC_DMA_TX_5:
case AFE_PORT_ID_RX_CODEC_DMA_RX_6:
case AFE_PORT_ID_RX_CODEC_DMA_RX_7:
case RT_PROXY_PORT_002_RX:
case RT_PROXY_PORT_002_TX:
{
ret = 0;
break;

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
@@ -385,6 +385,10 @@ int q6audio_get_port_index(u16 port_id)
return IDX_AFE_PORT_ID_RX_CODEC_DMA_RX_6;
case AFE_PORT_ID_RX_CODEC_DMA_RX_7:
return IDX_AFE_PORT_ID_RX_CODEC_DMA_RX_7;
case RT_PROXY_PORT_002_RX:
return IDX_RT_PROXY_PORT_002_RX;
case RT_PROXY_PORT_002_TX:
return IDX_RT_PROXY_PORT_002_TX;
default: return -EINVAL;
}
}
@@ -767,6 +771,10 @@ int q6audio_get_port_id(u16 port_id)
return AFE_PORT_ID_RX_CODEC_DMA_RX_6;
case AFE_PORT_ID_RX_CODEC_DMA_RX_7:
return AFE_PORT_ID_RX_CODEC_DMA_RX_7;
case RT_PROXY_PORT_002_RX:
return RT_PROXY_PORT_002_RX;
case RT_PROXY_PORT_002_TX:
return RT_PROXY_PORT_002_TX;
default:
pr_warn("%s: Invalid port_id %d\n", __func__, port_id);
return -EINVAL;
@@ -1196,6 +1204,8 @@ int q6audio_validate_port(u16 port_id)
case AFE_PORT_ID_TX_CODEC_DMA_TX_5:
case AFE_PORT_ID_RX_CODEC_DMA_RX_6:
case AFE_PORT_ID_RX_CODEC_DMA_RX_7:
case RT_PROXY_PORT_002_RX:
case RT_PROXY_PORT_002_TX:
{
ret = 0;
break;

View File

@@ -1385,7 +1385,7 @@ struct adm_cmd_connect_afe_port_v5 {
#define AFE_PORT_ID_SLIMBUS_RANGE_SIZE 0xA
/* Size of the range of port IDs for real-time proxy ports. */
#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE 0x2
#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE 0x4
/* Size of the range of port IDs for pseudoports. */
#define AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE 0x5
@@ -1664,6 +1664,16 @@ struct adm_cmd_connect_afe_port_v5 {
#define AFE_PORT_ID_VOICE2_PLAYBACK_TX 0x8002
#define AFE_PORT_ID_VOICE_PLAYBACK_TX 0x8005
/*
* Proxyport used for voice call data processing.
* In cases like call-screening feature, where user can communicate
* with caller with the help of "call screen" mode, and without
* connecting the call with any HW input/output devices in the phone,
* voice call can use Proxy port to start voice data processing.
*/
#define RT_PROXY_PORT_002_TX 0x2003
#define RT_PROXY_PORT_002_RX 0x2002
#define AFE_PORT_ID_PRIMARY_TDM_RX \
(AFE_PORT_ID_TDM_PORT_RANGE_START + 0x00)
#define AFE_PORT_ID_PRIMARY_TDM_RX_1 \

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __Q6AFE_V2_H__
#define __Q6AFE_V2_H__
@@ -284,6 +284,9 @@ enum {
/* IDX 208-> 209 */
IDX_AFE_PORT_ID_PRIMARY_META_MI2S_RX,
IDX_AFE_PORT_ID_SECONDARY_META_MI2S_RX,
/* IDX 210-> 211 */
IDX_RT_PROXY_PORT_002_RX,
IDX_RT_PROXY_PORT_002_TX,
AFE_MAX_PORTS
};