asoc: add change for proxy playback and capture BE DAIs

Add change to support BE DAI link based on proxy
ports.

Change-Id: Id7ca274e330f025ac015567de86403fb14781cd0
Signed-off-by: Saurav Kumar <sauravk@codeaurora.org>
This commit is contained in:
Saurav Kumar
2020-03-16 19:51:19 +05:30
parent 70561ef6c1
commit a2efe09c14
7 changed files with 125 additions and 8 deletions

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>
@@ -2620,6 +2620,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:
@@ -4246,6 +4248,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",
@@ -7286,7 +7324,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

@@ -696,6 +696,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
@@ -3487,7 +3489,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,
@@ -16688,6 +16690,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,
@@ -16785,6 +16798,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[] = {
@@ -16880,6 +16896,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[] = {
@@ -24028,6 +24047,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,
@@ -24457,6 +24478,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,
@@ -27300,6 +27325,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"},
@@ -27467,6 +27498,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"},
@@ -27496,6 +27528,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"},
@@ -28801,6 +28834,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"},
@@ -28897,6 +28931,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

@@ -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.
*/
#ifndef _MSM_PCM_ROUTING_H
#define _MSM_PCM_ROUTING_H
@@ -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"
@@ -500,6 +502,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

@@ -972,6 +972,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:
@@ -4565,6 +4567,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:
@@ -5112,6 +5116,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;
@@ -7309,6 +7317,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

@@ -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.
*/
@@ -1384,7 +1384,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
@@ -1663,6 +1663,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
};