]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
tegra-alt: dmic: Add output bit-width control
authorViswanath L <viswanathl@nvidia.com>
Fri, 9 Jun 2017 11:48:31 +0000 (17:18 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 22 Jun 2017 12:01:34 +0000 (05:01 -0700)
"output bit format" ctl added to set TX CIF bit-width

Bug 1936284

Change-Id: Ifeec48c9c8adc50c5ec16c237b39451511a8ceb0
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1505598
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
sound/soc/tegra-alt/tegra210_dmic_alt.c
sound/soc/tegra-alt/tegra210_dmic_alt.h

index 393f86d8b7a757047052db14c9c8bc73086dd3eb..cf2f2d4d57ef0c7902ccc7b1dd962aecc8aad759 100644 (file)
@@ -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 = {
index 72eb9d8df8acb8c9e91b3f14cbc41399e310a6ba..8a0795d9f03133d5d6369eaa18400e334e3a058a 100644 (file)
@@ -133,6 +133,7 @@ struct tegra210_dmic {
        int ch_select;
        int tx_mono_to_stereo;
        bool is_shutdown;
+       int format_out;
 };
 
 #endif