From: Viswanath L Date: Fri, 9 Jun 2017 11:48:31 +0000 (+0530) Subject: tegra-alt: dmic: Add output bit-width control X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hercules2020/nv-tegra/linux-4.4.git/commitdiff_plain/8bde6dd5bb5f923aea9a3d9dbe6dec1cb8aeb0ac tegra-alt: dmic: Add output bit-width control "output bit format" ctl added to set TX CIF bit-width Bug 1936284 Change-Id: Ifeec48c9c8adc50c5ec16c237b39451511a8ceb0 Signed-off-by: Viswanath L Reviewed-on: http://git-master/r/1505598 GVS: Gerrit_Virtual_Submit Reviewed-by: Mohan Kumar D Reviewed-by: Ravindra Lokhande --- diff --git a/sound/soc/tegra-alt/tegra210_dmic_alt.c b/sound/soc/tegra-alt/tegra210_dmic_alt.c index 393f86d8b7a7..cf2f2d4d57ef 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.c +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.c @@ -146,6 +146,12 @@ static int tegra210_dmic_set_dai_bclk_ratio(struct snd_soc_dai *dai, return 0; } +static const int tegra210_dmic_fmt_values[] = { + 0, + TEGRA210_AUDIOCIF_BITS_16, + TEGRA210_AUDIOCIF_BITS_32, +}; + static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -268,6 +274,9 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } + if (dmic->format_out) + cif_conf.audio_bits = tegra210_dmic_fmt_values[dmic->format_out]; + cif_conf.client_bits = TEGRA210_AUDIOCIF_BITS_24; dmic->soc_data->set_audio_cif(dmic->regmap, TEGRA210_DMIC_TX_CIF_CTRL, @@ -289,6 +298,8 @@ static int tegra210_dmic_get_control(struct snd_kcontrol *kcontrol, else if (strstr(kcontrol->id.name, "TX mono to stereo")) ucontrol->value.integer.value[0] = dmic->tx_mono_to_stereo; + else if (strstr(kcontrol->id.name, "output bit format")) + ucontrol->value.integer.value[0] = dmic->format_out; return 0; } @@ -306,6 +317,8 @@ static int tegra210_dmic_put_control(struct snd_kcontrol *kcontrol, dmic->ch_select = ucontrol->value.integer.value[0]; else if (strstr(kcontrol->id.name, "TX mono to stereo")) dmic->tx_mono_to_stereo = value; + else if (strstr(kcontrol->id.name, "output bit format")) + dmic->format_out = value; return 0; } @@ -382,6 +395,17 @@ static const struct soc_enum tegra210_dmic_mono_conv_enum = ARRAY_SIZE(tegra210_dmic_mono_conv_text), tegra210_dmic_mono_conv_text); +static const char * const tegra210_dmic_format_text[] = { + "None", + "16", + "32", +}; + +static const struct soc_enum tegra210_dmic_format_enum = + SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, + ARRAY_SIZE(tegra210_dmic_format_text), + tegra210_dmic_format_text); + static const struct snd_kcontrol_new tegra210_dmic_controls[] = { SOC_SINGLE_EXT("Boost Gain", 0, 0, 25600, 0, tegra210_dmic_get_control, tegra210_dmic_put_control), @@ -389,6 +413,8 @@ static const struct snd_kcontrol_new tegra210_dmic_controls[] = { tegra210_dmic_get_control, tegra210_dmic_put_control), SOC_ENUM_EXT("TX mono to stereo conv", tegra210_dmic_mono_conv_enum, tegra210_dmic_get_control, tegra210_dmic_put_control), + SOC_ENUM_EXT("output bit format", tegra210_dmic_format_enum, + tegra210_dmic_get_control, tegra210_dmic_put_control), }; static struct snd_soc_codec_driver tegra210_dmic_codec = { diff --git a/sound/soc/tegra-alt/tegra210_dmic_alt.h b/sound/soc/tegra-alt/tegra210_dmic_alt.h index 72eb9d8df8ac..8a0795d9f031 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.h +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.h @@ -133,6 +133,7 @@ struct tegra210_dmic { int ch_select; int tx_mono_to_stereo; bool is_shutdown; + int format_out; }; #endif