ASoC: tegra-alt: Add new controls for I2S mono/stereo conversion

The names of the I2S mixer controls for mono/stereo conversion are
confusing from a user perspective because the controls 'I2Sx TX mono
to stereo conv' and 'I2Sx TX stereo to mono conv' are for capture and
the controls 'I2Sx RX mono to stereo conv', 'I2Sx RX stereo to mono
conv' and 'I2Sx Rx fifo threshold' are for playback. The naming
convention  for these controls comes from the XBAR CIF and makes sense
from that standpoint. However, from a user and userspace perspective
the names are confusing and misleading. Therefore, add new controls
that are explicitly named "Capture" and "Playback" so it is clear
which should be used.

The legacy controls will be kept for Android until the appropriate
userspace changes have been made so that these can be removed
completely.

Bug 200469957

Change-Id: I93ae9339128a056e2144ba751a86f9df21b3dfda
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
(cherry picked from commit 843dfa3a418d336bca49144e065556dce8d0cd4e)
Reviewed-on: https://git-master.nvidia.com/r/2002204
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jonathan Hunter
2019-01-14 13:13:47 +00:00
committed by Sameer Pujar
parent c935ff0f9b
commit 5936a0e40d

View File

@@ -461,6 +461,7 @@ static int tegra210_i2s_get_format(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[0] = i2s->sample_rate_via_control; ucontrol->value.integer.value[0] = i2s->sample_rate_via_control;
else if (strstr(kcontrol->id.name, "Channels")) else if (strstr(kcontrol->id.name, "Channels"))
ucontrol->value.integer.value[0] = i2s->channels_via_control; ucontrol->value.integer.value[0] = i2s->channels_via_control;
#if defined(CONFIG_ANDROID)
else if (strstr(kcontrol->id.name, "RX stereo to mono")) else if (strstr(kcontrol->id.name, "RX stereo to mono"))
ucontrol->value.integer.value[0] = ucontrol->value.integer.value[0] =
i2s->stereo_to_mono[I2S_RX_PATH]; i2s->stereo_to_mono[I2S_RX_PATH];
@@ -475,6 +476,21 @@ static int tegra210_i2s_get_format(struct snd_kcontrol *kcontrol,
i2s->mono_to_stereo[I2S_TX_PATH]; i2s->mono_to_stereo[I2S_TX_PATH];
else if (strstr(kcontrol->id.name, "Rx fifo threshold")) else if (strstr(kcontrol->id.name, "Rx fifo threshold"))
ucontrol->value.integer.value[0] = i2s->rx_fifo_th; ucontrol->value.integer.value[0] = i2s->rx_fifo_th;
#endif
else if (strstr(kcontrol->id.name, "Capture stereo to mono"))
ucontrol->value.integer.value[0] =
i2s->stereo_to_mono[I2S_TX_PATH];
else if (strstr(kcontrol->id.name, "Capture mono to stereo"))
ucontrol->value.integer.value[0] =
i2s->mono_to_stereo[I2S_TX_PATH];
else if (strstr(kcontrol->id.name, "Playback stereo to mono"))
ucontrol->value.integer.value[0] =
i2s->stereo_to_mono[I2S_RX_PATH];
else if (strstr(kcontrol->id.name, "Playback mono to stereo"))
ucontrol->value.integer.value[0] =
i2s->mono_to_stereo[I2S_RX_PATH];
else if (strstr(kcontrol->id.name, "Playback FIFO threshold"))
ucontrol->value.integer.value[0] = i2s->rx_fifo_th;
return 0; return 0;
} }
@@ -495,6 +511,7 @@ static int tegra210_i2s_put_format(struct snd_kcontrol *kcontrol,
i2s->sample_rate_via_control = value; i2s->sample_rate_via_control = value;
else if (strstr(kcontrol->id.name, "Channels")) else if (strstr(kcontrol->id.name, "Channels"))
i2s->channels_via_control = value; i2s->channels_via_control = value;
#if defined(CONFIG_ANDROID)
else if (strstr(kcontrol->id.name, "RX stereo to mono")) else if (strstr(kcontrol->id.name, "RX stereo to mono"))
i2s->stereo_to_mono[I2S_RX_PATH] = value; i2s->stereo_to_mono[I2S_RX_PATH] = value;
else if (strstr(kcontrol->id.name, "RX mono to stereo")) else if (strstr(kcontrol->id.name, "RX mono to stereo"))
@@ -509,6 +526,21 @@ static int tegra210_i2s_put_format(struct snd_kcontrol *kcontrol,
else else
return -EINVAL; return -EINVAL;
} }
#endif
else if (strstr(kcontrol->id.name, "Capture stereo to mono"))
i2s->stereo_to_mono[I2S_TX_PATH] = value;
else if (strstr(kcontrol->id.name, "Capture mono to stereo"))
i2s->mono_to_stereo[I2S_TX_PATH] = value;
else if (strstr(kcontrol->id.name, "Playback stereo to mono"))
i2s->stereo_to_mono[I2S_RX_PATH] = value;
else if (strstr(kcontrol->id.name, "Playback mono to stereo"))
i2s->mono_to_stereo[I2S_RX_PATH] = value;
else if (strstr(kcontrol->id.name, "Playback FIFO threshold")) {
if (value >= 0 && value < TEGRA210_I2S_RX_FIFO_DEPTH)
i2s->rx_fifo_th = value;
else
return -EINVAL;
}
return 0; return 0;
} }
@@ -894,6 +926,13 @@ static const struct snd_kcontrol_new tegra210_i2s_controls[] = {
tegra210_i2s_get_format, tegra210_i2s_put_format), tegra210_i2s_get_format, tegra210_i2s_put_format),
SOC_SINGLE_EXT("Channels", 0, 0, 16, 0, SOC_SINGLE_EXT("Channels", 0, 0, 16, 0,
tegra210_i2s_get_format, tegra210_i2s_put_format), tegra210_i2s_get_format, tegra210_i2s_put_format),
#if defined(CONFIG_ANDROID)
/*
* FIXME: The following 'RX/TX stereo to mono', 'RX/TX mono to
* stereo' and 'Rx fifo threshold' controls have been deprecated
* and should no longer be used. Instead the below 'Capture' and
* 'Playback' versions should be used.
*/
SOC_ENUM_EXT("RX stereo to mono conv", tegra210_i2s_stereo_conv_enum, SOC_ENUM_EXT("RX stereo to mono conv", tegra210_i2s_stereo_conv_enum,
tegra210_i2s_get_format, tegra210_i2s_put_format), tegra210_i2s_get_format, tegra210_i2s_put_format),
SOC_ENUM_EXT("RX mono to stereo conv", tegra210_i2s_mono_conv_enum, SOC_ENUM_EXT("RX mono to stereo conv", tegra210_i2s_mono_conv_enum,
@@ -905,6 +944,23 @@ static const struct snd_kcontrol_new tegra210_i2s_controls[] = {
NV_SOC_SINGLE_RANGE_EXT("Rx fifo threshold", 0, NV_SOC_SINGLE_RANGE_EXT("Rx fifo threshold", 0,
TEGRA210_I2S_RX_FIFO_DEPTH - 1, tegra210_i2s_get_format, TEGRA210_I2S_RX_FIFO_DEPTH - 1, tegra210_i2s_get_format,
tegra210_i2s_put_format), tegra210_i2s_put_format),
#endif
SOC_ENUM_EXT("Capture stereo to mono conv",
tegra210_i2s_stereo_conv_enum, tegra210_i2s_get_format,
tegra210_i2s_put_format),
SOC_ENUM_EXT("Capture mono to stereo conv",
tegra210_i2s_mono_conv_enum, tegra210_i2s_get_format,
tegra210_i2s_put_format),
SOC_ENUM_EXT("Playback stereo to mono conv",
tegra210_i2s_stereo_conv_enum, tegra210_i2s_get_format,
tegra210_i2s_put_format),
SOC_ENUM_EXT("Playback mono to stereo conv",
tegra210_i2s_mono_conv_enum, tegra210_i2s_get_format,
tegra210_i2s_put_format),
NV_SOC_SINGLE_RANGE_EXT("Playback FIFO threshold", 0,
TEGRA210_I2S_RX_FIFO_DEPTH - 1,
tegra210_i2s_get_format,
tegra210_i2s_put_format),
}; };
static const struct snd_soc_dapm_widget tegra210_i2s_widgets[] = { static const struct snd_soc_dapm_widget tegra210_i2s_widgets[] = {