asoc: sa8155: Add support to configure proxy capture channels

Add mixer control to set number of backend channels for AFE_PCM_TX

Change-Id: I978ab0a0b00088efd23e544b18b8f88147109373
Signed-off-by: Tahir Dawson <dawson@codeaurora.org>
This commit is contained in:
Tahir Dawson 2021-05-04 16:39:54 -04:00 • committed by Gerrit - the friendly Code Review server
commit 6955a33fec

View file

@ -311,6 +311,15 @@ static struct dev_config proxy_rx_cfg[] = {
}
};
static struct dev_config proxy_tx_cfg[] = {
{
.sample_rate = SAMPLING_RATE_48KHZ,
.bit_format = SNDRV_PCM_FORMAT_S16_LE,
.channels = 2,
},
};
/* Default configuration of MI2S channels */
static struct dev_config mi2s_rx_cfg[] = {
[PRIM_MI2S] = {SAMPLING_RATE_48KHZ, SNDRV_PCM_FORMAT_S16_LE, 2},
@ -654,6 +663,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_chs, usb_ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_chs, usb_ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_chs, ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(proxy_rx_chs, ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(proxy_tx_chs, ch_text);
static SOC_ENUM_SINGLE_EXT_DECL(usb_rx_format, bit_format_text);
static SOC_ENUM_SINGLE_EXT_DECL(usb_tx_format, bit_format_text);
static SOC_ENUM_SINGLE_EXT_DECL(ext_disp_rx_format, ext_disp_bit_format_text);
@ -1335,6 +1345,27 @@ static int proxy_rx_ch_put(struct snd_kcontrol *kcontrol,
return 1;
}
static int proxy_tx_ch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = proxy_tx_cfg[0].channels - 2;
pr_debug("%s: proxy_tx channels = %d\n",
__func__, proxy_tx_cfg[0].channels);
return 0;
}
static int proxy_tx_ch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
proxy_tx_cfg[0].channels = ucontrol->value.integer.value[0] + 2;
pr_debug("%s: proxy_tx channels = %d\n",
__func__, proxy_tx_cfg[0].channels);
return 1;
}
static int tdm_get_sample_rate(int value)
{
int sample_rate = 0;
@ -2657,6 +2688,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
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("PROXY_TX Channels", proxy_tx_chs,
proxy_tx_ch_get, proxy_tx_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,
@ -3403,6 +3436,11 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
rate->min = rate->max = SAMPLING_RATE_48KHZ;
break;
case MSM_BACKEND_DAI_AFE_PCM_TX:
channels->min = channels->max = proxy_tx_cfg[0].channels;
rate->min = rate->max = SAMPLING_RATE_48KHZ;
break;
case MSM_BACKEND_DAI_PRI_TDM_RX_0:
channels->min = channels->max =
tdm_rx_cfg[TDM_PRI][TDM_0].channels;