Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6955a33f authored by Tahir Dawson's avatar Tahir Dawson Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarTahir Dawson <dawson@codeaurora.org>
parent 83feb0e6
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -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;