ASoC: msm: add proxy port and pcm backend in machine driver
* Add additional proxy port frontend and pcm backend to support dual proxy port * Add channel configuration mixer control for second proxy port Change-Id: Iba7e21f17122926d27acc58be653351b4d0ea37a Signed-off-by: Alexy Joseph <alexyj@codeaurora.org> Signed-off-by: Tahir Dawson <dawson@codeaurora.org>
This commit is contained in:
parent
dec796e30a
commit
4dad2aea99
@ -383,6 +383,11 @@ SND_SOC_DAILINK_DEFS(afe_pcm_rx,
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||
|
||||
SND_SOC_DAILINK_DEFS(afe_pcm_rx1,
|
||||
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-dev.226")),
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||
|
||||
SND_SOC_DAILINK_DEFS(afe_pcm_tx,
|
||||
DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-dev.225")),
|
||||
DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||
|
@ -295,10 +295,17 @@ static struct dev_config usb_tx_cfg = {
|
||||
.channels = 1,
|
||||
};
|
||||
|
||||
static struct dev_config proxy_rx_cfg = {
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
static struct dev_config proxy_rx_cfg[] = {
|
||||
{
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
},
|
||||
{
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
}
|
||||
};
|
||||
|
||||
/* Default configuration of MI2S channels */
|
||||
@ -1293,9 +1300,16 @@ static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
|
||||
static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg.channels);
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg.channels - 2;
|
||||
if(strnstr(kcontrol->id.name, "RX1", sizeof(kcontrol->id.name))) {
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg[1].channels - 2;
|
||||
pr_debug("%s: proxy_rx1 channels = %d\n",
|
||||
__func__, proxy_rx_cfg[1].channels);
|
||||
}
|
||||
else {
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg[0].channels - 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg[0].channels);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1303,9 +1317,16 @@ static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
|
||||
static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
proxy_rx_cfg.channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg.channels);
|
||||
if(strnstr(kcontrol->id.name, "RX1", sizeof(kcontrol->id.name))) {
|
||||
proxy_rx_cfg[1].channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx1 channels = %d\n",
|
||||
__func__, proxy_rx_cfg[1].channels);
|
||||
}
|
||||
else {
|
||||
proxy_rx_cfg[0].channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg[0].channels);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2630,6 +2651,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
|
||||
ext_disp_rx_ch_get, ext_disp_rx_ch_put),
|
||||
SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
|
||||
proxy_rx_ch_get, proxy_rx_ch_put),
|
||||
SOC_ENUM_EXT("PROXY_RX1 Channels", proxy_rx_chs,
|
||||
proxy_rx_ch_get, proxy_rx_ch_put),
|
||||
SOC_ENUM_EXT("USB_AUDIO_RX Format", usb_rx_format,
|
||||
usb_audio_rx_format_get, usb_audio_rx_format_put),
|
||||
SOC_ENUM_EXT("USB_AUDIO_TX Format", usb_tx_format,
|
||||
@ -3367,7 +3390,12 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
||||
break;
|
||||
|
||||
case MSM_BACKEND_DAI_AFE_PCM_RX:
|
||||
channels->min = channels->max = proxy_rx_cfg.channels;
|
||||
channels->min = channels->max = proxy_rx_cfg[0].channels;
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
|
||||
case MSM_BACKEND_DAI_AFE_PCM_RX1:
|
||||
channels->min = channels->max = proxy_rx_cfg[1].channels;
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
|
||||
@ -5835,6 +5863,13 @@ static struct snd_soc_dai_link msm_auto_fe_dai_links[] = {
|
||||
.id = MSM_FRONTEND_DAI_MULTIMEDIA34,
|
||||
SND_SOC_DAILINK_REG(multimedia34),
|
||||
},
|
||||
{
|
||||
.name = "MSM AFE-PCM TX1",
|
||||
.stream_name = "AFE-PROXY TX1",
|
||||
.dpcm_capture = 1,
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(afepcm_tx1),
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link msm_custom_fe_dai_links[] = {
|
||||
@ -6561,6 +6596,18 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = {
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(quin_tdm_tx_7),
|
||||
},
|
||||
{
|
||||
.name = LPASS_BE_AFE_PCM_RX1,
|
||||
.stream_name = "AFE Playback1",
|
||||
.no_pcm = 1,
|
||||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_AFE_PCM_RX1,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
/* this dainlink has playback support */
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(afe_pcm_rx1),
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
|
||||
|
@ -297,10 +297,17 @@ static struct dev_config usb_tx_cfg = {
|
||||
.channels = 1,
|
||||
};
|
||||
|
||||
static struct dev_config proxy_rx_cfg = {
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
static struct dev_config proxy_rx_cfg[] = {
|
||||
{
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
},
|
||||
{
|
||||
.sample_rate = SAMPLING_RATE_48KHZ,
|
||||
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
|
||||
.channels = 2,
|
||||
}
|
||||
};
|
||||
|
||||
/* Default configuration of MI2S channels */
|
||||
@ -1296,9 +1303,16 @@ static int ext_disp_rx_sample_rate_put(struct snd_kcontrol *kcontrol,
|
||||
static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg.channels);
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg.channels - 2;
|
||||
if(strnstr(kcontrol->id.name, "RX1", sizeof(kcontrol->id.name))) {
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg[1].channels - 2;
|
||||
pr_debug("%s: proxy_rx1 channels = %d\n",
|
||||
__func__, proxy_rx_cfg[1].channels);
|
||||
}
|
||||
else {
|
||||
ucontrol->value.integer.value[0] = proxy_rx_cfg[0].channels - 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg[0].channels);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1306,9 +1320,16 @@ static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
|
||||
static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
proxy_rx_cfg.channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg.channels);
|
||||
if(strnstr(kcontrol->id.name, "RX1", sizeof(kcontrol->id.name))) {
|
||||
proxy_rx_cfg[1].channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx1 channels = %d\n",
|
||||
__func__, proxy_rx_cfg[1].channels);
|
||||
}
|
||||
else {
|
||||
proxy_rx_cfg[0].channels = ucontrol->value.integer.value[0] + 2;
|
||||
pr_debug("%s: proxy_rx channels = %d\n",
|
||||
__func__, proxy_rx_cfg[0].channels);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2633,6 +2654,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
|
||||
ext_disp_rx_ch_get, ext_disp_rx_ch_put),
|
||||
SOC_ENUM_EXT("PROXY_RX Channels", proxy_rx_chs,
|
||||
proxy_rx_ch_get, proxy_rx_ch_put),
|
||||
SOC_ENUM_EXT("PROXY_RX1 Channels", proxy_rx_chs,
|
||||
proxy_rx_ch_get, proxy_rx_ch_put),
|
||||
SOC_ENUM_EXT("USB_AUDIO_RX Format", usb_rx_format,
|
||||
usb_audio_rx_format_get, usb_audio_rx_format_put),
|
||||
SOC_ENUM_EXT("USB_AUDIO_TX Format", usb_tx_format,
|
||||
@ -3370,7 +3393,12 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
||||
break;
|
||||
|
||||
case MSM_BACKEND_DAI_AFE_PCM_RX:
|
||||
channels->min = channels->max = proxy_rx_cfg.channels;
|
||||
channels->min = channels->max = proxy_rx_cfg[0].channels;
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
|
||||
case MSM_BACKEND_DAI_AFE_PCM_RX1:
|
||||
channels->min = channels->max = proxy_rx_cfg[1].channels;
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
|
||||
@ -5832,6 +5860,13 @@ static struct snd_soc_dai_link msm_auto_fe_dai_links[] = {
|
||||
.id = MSM_FRONTEND_DAI_MULTIMEDIA34,
|
||||
SND_SOC_DAILINK_REG(multimedia34),
|
||||
},
|
||||
{
|
||||
.name = "MSM AFE-PCM TX1",
|
||||
.stream_name = "AFE-PROXY TX1",
|
||||
.dpcm_capture = 1,
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(afepcm_tx1),
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link msm_custom_fe_dai_links[] = {
|
||||
@ -6558,6 +6593,18 @@ static struct snd_soc_dai_link msm_auto_be_dai_links[] = {
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(quin_tdm_tx_7),
|
||||
},
|
||||
{
|
||||
.name = LPASS_BE_AFE_PCM_RX1,
|
||||
.stream_name = "AFE Playback1",
|
||||
.no_pcm = 1,
|
||||
.dpcm_playback = 1,
|
||||
.id = MSM_BACKEND_DAI_AFE_PCM_RX1,
|
||||
.be_hw_params_fixup = msm_be_hw_params_fixup,
|
||||
/* this dainlink has playback support */
|
||||
.ignore_pmdown_time = 1,
|
||||
.ignore_suspend = 1,
|
||||
SND_SOC_DAILINK_REG(afe_pcm_rx1),
|
||||
},
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link ext_disp_be_dai_link[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user